#include <stdio.h>
#include <sys/time.h>

#define ROW_A 2048
#define COL_A 512
#define ROW_B 512
#define COL_B 1024

int A[ROW_A][COL_A] = {[0 ... ROW_A - 1] = {[0 ... COL_A - 1] = 1}};
int B[ROW_B][COL_B] = {[0 ... ROW_B - 1] = {[0 ... COL_B - 1] = 1}};
int C[ROW_A][COL_B];

int main() {
    struct timeval begin, end;

    gettimeofday(&begin, NULL);
    for (size_t i = 0; i < ROW_A; i++)
    {
        for (size_t t = 0; t < COL_A; t++)
        {
            for (size_t j = 0; j < COL_B; j++)
            {
                C[i][j] += (A[i][t] * B[t][j]);
            }
        }
    }
    
    gettimeofday(&end, NULL);
    long time_used = 1000000 * (end.tv_sec - begin.tv_sec) + end.tv_usec - begin.tv_usec;
    printf("Total time: %ld us\n", time_used);
    printf("%d\n", C[0][0]);

    return 0;
}